package com.qiyue.admin.entity.base.log;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.qiyue.common.model.BaseEntity;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import java.util.List;

/**
 * 业务日志系统
 */
@Entity
@Table(name = "sys_biz_log")
public class BizLogEntity  extends BaseEntity{



    @Column( name = "table_name" , length = 32)
    @ApiModelProperty( value = "操作的表名")
    private String tableName;

    @Column( name = "biz_name" , length = 32)
    private String bizName;

    @Column( name = "method" , length = 32)
    @ApiModelProperty(value = "方法名")
    private String method;

    @Column( name = "url" , length = 100)
    @ApiModelProperty( value =  "请求路径")
    private String url;

    @Column( name = "operation_type" , length = 16)
    @ApiModelProperty( value = "操作类型")
    private String OperationType;


    @Column( name = "exception" , length = 32)
    @ApiModelProperty( value = "异常信息")
    private String exception;

    @Column( name = "description", length = 155)
    @ApiModelProperty( value = "日志描述")
    private String description;


    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getBizName() {
        return bizName;
    }

    public void setBizName(String bizName) {
        this.bizName = bizName;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getOperationType() {
        return OperationType;
    }

    public void setOperationType(String operationType) {
        OperationType = operationType;
    }

    public String getException() {
        return exception;
    }

    public void setException(String exception) {
        this.exception = exception;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    /**
     * 级联
     */

    @ApiModelProperty( value = "日志详情")
    private List<BizLogDateilEntity> bizLogDateils;



    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy="bizLog")
    @JsonIgnore
    public List<BizLogDateilEntity> getBizLogDateils() {
        return bizLogDateils;
    }

    public void setBizLogDateils(List<BizLogDateilEntity> bizLogDateils) {
        this.bizLogDateils = bizLogDateils;
    }

    @Override
    public String toString() {
        return "BizLogEntity{" +
                "tableName='" + tableName + '\'' +
                ", bizName='" + bizName + '\'' +
                ", method='" + method + '\'' +
                ", url='" + url + '\'' +
                ", OperationType='" + OperationType + '\'' +
                ", exception='" + exception + '\'' +
                ", description='" + description + '\'' +
                ", bizLogDateils=" + bizLogDateils +
                '}';
    }
}
